#ifndef MYORDERSPANEL_H
#define MYORDERSPANEL_H

#include <QDialog>

// Forward declarations for Qt UI elements
class QTableWidget;
class QLabel;
class QPushButton;

// Forward declarations for C backend structs (optional but good practice)
struct OrderNode;
struct DrinkNode;

class MyOrdersPanel : public QDialog
{
    Q_OBJECT

public:
    explicit MyOrdersPanel(QWidget *parent = nullptr);
    ~MyOrdersPanel();

    // Public method to load orders for a specific user
    void loadOrders(int userId);

private slots:
    // Slot connected to the refresh button
    void refreshOrders();

private:
    // UI Setup
    void setupUi();
    void populateTable(); // Helper to fill the table from loaded data
    void clearTable();

    // UI Elements
    QTableWidget *orderTable;
    QLabel *statusLabel;
    QPushButton *refreshButton;

    // Data
    int currentUserId = -1; // ID of the currently logged-in user
    OrderNode* orderListHead = nullptr; // Head of the loaded order list (temporary)
    DrinkNode* drinkListHead = nullptr; // Head of the loaded drink list (for lookups)

    // Helper to free C linked lists (if needed outside loadOrders)
    // void freeOrderList();
    // void freeDrinkList();
};

#endif // MYORDERSPANEL_H